package com.itstyle.seckill.common.designPattern.zhongjie;

public class People {
    private String name;
    private People other;

    public People(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setOther(People other) {
        this.other = other;
    }

    public void talk(String msg){
        other.listen(msg);
    }
    public void listen(String msg){
        System.out.println(this.name +"--对--"+ other.name+"说："+ msg);
    }

    public static void main(String[] args) {
        People p1 = new People("聂风");
        People p2 = new People("步惊云");
        p1.setOther(p2);
        p2.setOther(p1);
        p1.talk("你血饮刀去哪了");
        p2.talk("哈哈早卖了");
    }
}
